﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace blackhouse.BlackApart.Business.Payments {
    public class ImpPaymentType : IPaymentType {

        #region Fields

        private IPaymentType[] webPayments;

        #endregion

        #region Properties

        public int Id { get; set; }
        public string Key { get; set; }
        public bool WaitForCash { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public double ExtraRabat { get; set; }
        public IPaymentType[] WebPayments {
            get {
                return this.webPayments;
            }
            set {
                if (value == null)
                    this.webPayments = null;
                else
                    this.webPayments = value.OrderByDescending(pt => pt.ExtraRabat).ToArray();
            }
        }

        #endregion

        #region Methods

        public IPaymentType[] GetWebPayments() {
            if (this.WebPayments != null) {
                return this.WebPayments;
            }
            else return new IPaymentType[0];
        }

        #endregion

    }
}
